package com.kongwg.java;

/**
 *
 * 静态代理举例
 * @author kongwg
 * @create 2020-12-25 10:13
 */
interface ClothFactory{
    void produceClth();
}

class ProxyClothFactory implements ClothFactory{
    ClothFactory factory;

    public ProxyClothFactory(ClothFactory factory) {
        this.factory = factory;
    }

    @Override
    public void produceClth() {
        System.out.println("代理工厂做准备工作");
        factory.produceClth();
        System.out.println("代理工厂做收尾工作");
    }


}

class NikeFactory implements ClothFactory{

    @Override
    public void produceClth() {
        System.out.println("Nike工厂生产鞋子");
    }
}
public class StaticProxyTest {

    public static void main(String[] args) {
        NikeFactory nikeFactory = new NikeFactory();

        ClothFactory proxyClothFactory = new ProxyClothFactory(nikeFactory);
        proxyClothFactory.produceClth();
    }

}
